Generating Efficient Code for Lazy Functional Languages

نویسندگان

  • Sjaak Smetsers
  • Eric Nöcker
  • John H. G. van Groningen
  • Marinus J. Plasmeijer
چکیده

In this paper we will discuss how a good code generator can be built for (lazy) functional languages. Starting from Concurrent Clean, an experimental lazy functional programming language, code is generated for an intermediate abstract machine: the ABC machine. In this rst pass many well-known optimisation techniques are included. However, we will also present some new ideas in this area, like the way in which strictness can be incorporated, and the implementation of higher order functions. In a second pass, the ABC code is translated to concrete target code for the Motorola MC680x0 processor. Again many optimisation methods appear to be applicable. Some of them (for example register allocation algorithms) are common for the implementation of other types of languages, but have to be adapted because of the speciic properties of both source language and target machine. Other optimisations are speciic for lazy functional languages, e.g. the implementation of higher order functions, eecient memory management and the optimised graph reduction. Measurements demonstrate that due to the optimisations of both passes very fast code can be generated. We have compared Concurrent Clean with two other functional languages, namely Lml and Hope, and also with the imperative language C. With respect to both functional languages this comparison clearly goes in favour of Concurrent Clean. Furthermore, we can conclude that, when using the presented compilation techniques, a lazy functional language is able to compete even with an imperative language such as C.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Target code generation from G-machine code

The G-machine is a stack machine for von-Neumann-like execution of lazy functional languages, using graph reduction. This paper describes how target code generation from G-machine code is performed in a compiler for Lazy ML. We brieey review the G-machine, and the compiler phases preceding the target code generation. Two diierent target code generation methods are described, as well as essentia...

متن کامل

CASE — A Lazy Version of an SECD Machine with a Flat Environment

Graph reduction has been the basis of most fast running implementations of functional languages, with little attention being paid recently to Landin's SECD approach. CASE is an abstract machine which supports applicative programming and is a variation of Landin's classical SECD machine. Its environment is organized in a novel way which makes variable access more efficient by removing the overhe...

متن کامل

Functional Programing

Welcome to the rst functional programming column! Functional programmers and formal methoders have much to say to each other, and this column is intended to further such communication. Functional programming supports formal methods. A large number of proof systems and other formal methods packages have been implemented in functional languages. ML, the doyen of functional languages, takes its na...

متن کامل

Tracing Lazy Functional Languages

We argue that Ariola and Felleisen's and Maraist, Odersky and Wadler's call-by-need lambda calculus forms a suitable formal basis for tracing evaluation in lazy functional languages. 1 Tracing functional languages One major advantage of pure, and especially lazy, functional languages over more conventional imperative languages is in not having to directly and completely specify the order of exe...

متن کامل

The GRIN Project: A Highly Optimising Back End for Lazy Functional Languages

Low level optimisations from conventional compiler technology often give very poor results when applied to code from lazy functional languages, mainly because of the completely diierent structure of the code, unknown control ow, etc. A novel approach to compiling laziness is needed. We describe a complete back end for lazy functional languages, which uses various interprocedural optimisations t...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1991